home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 246 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: engnews1.Eng.Sun.COM!usenet
  2. From: clamage@Eng.Sun.COM (Steve Clamage)
  3. Newsgroups: comp.std.c
  4. Subject: size_t
  5. Date: 29 Jan 1996 16:57:38 GMT
  6. Organization: Sun Microsystems Inc.
  7. Message-ID: <4eiua2$9u@engnews1.Eng.Sun.COM>
  8. Reply-To: clamage@Eng.Sun.COM
  9. NNTP-Posting-Host: 129.146.88.126
  10.  
  11.  
  12. I have always thought that type size_t must be defined as one of
  13. the standard unsigned integer types: unsigned [char | short | int | long].
  14. I don't find wording in the ISO standard requiring that, however.
  15. Sections 7.1.6 and 6.3.4 say it is an "unsigned integral type", a term
  16. I don't find defined. "Integer type" is defined, but not "integral type".
  17.  
  18. Example: A system has a 48-bit address space and 48-bit pointers, but does
  19. not have a 48-bit integer type. (The integer types are 8, 16, 32, and
  20. maybe 64 bits.) Suppose the implementation predefined an unsigned 48-bit
  21. type "__ptrsize", and size_t was typedef'd to be __ptrsize.
  22.  
  23. Is such an implementation intentionally allowed, accidently allowed, or
  24. not allowed by the Standard?
  25.  
  26. That is, the only question in my mind is whether size_t can be a type
  27. different from ALL of the standard types. I believe all the other
  28. characteristics of my hypothetical implementation are valid.
  29.  
  30. If it makes a difference, suppose that the standard headers (<stddef.h>, etc)
  31. are not readable by programmers, and the existence of type __ptrsize is
  32. not documented and is thus unknown to users of the implementation. All
  33. they can observe is that
  34.     sizeof(size_t) != sizeof(any_other_type)
  35. ---
  36. Steve Clamage, stephen.clamage@eng.sun.com
  37.  
  38.  
  39.